package com.chaos.system.api.feign;

import com.chaos.framework.model.constant.FeignConstants;
import com.chaos.framework.model.dto.ID;
import com.chaos.framework.model.dto.result.data.BooleanResult;
import com.chaos.framework.model.dto.result.data.DataResult;
import com.chaos.framework.model.dto.result.list.ListResult;
import com.chaos.system.api.constant.ServiceNameConstant;
import com.chaos.system.api.data.TUserData;
import com.chaos.system.api.data.UserSessionKeyData;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * C端用户能力
 */
@FeignClient(value = ServiceNameConstant.SYSTEM_SERVICE)
public interface UserFeign {

    @PostMapping(FeignConstants.FEIGN_PREFIX + "tUser/list")
    @ApiOperation(value = "用户列表", httpMethod = "POST")
    ListResult<TUserData> list(@RequestBody TUserData queryData);

    @PostMapping(FeignConstants.FEIGN_PREFIX + "tUser/selectByWxOpenId")
    @ApiOperation(value = "用户ByWxOpenId", httpMethod = "POST")
    DataResult<TUserData> selectByWxOpenId(@RequestParam String openId, @RequestParam Long tenantId);

    @PostMapping(FeignConstants.FEIGN_PREFIX + "tUser/insert")
    @ApiOperation(value = "新增", httpMethod = "POST")
    DataResult<ID> insertModel(@RequestBody TUserData user);

    @PostMapping(FeignConstants.FEIGN_PREFIX + "tUser/updateUserInfoId")
    @ApiOperation(value = "updateUserInfoId", httpMethod = "POST")
    BooleanResult updateUserInfoId(@RequestParam Long userInfoId);

    @PostMapping(FeignConstants.FEIGN_PREFIX + "userSessionKey/insert")
    @ApiOperation(value = "新增", httpMethod = "POST")
    DataResult<ID> insertModel(@RequestBody UserSessionKeyData data);

    @PostMapping(FeignConstants.FEIGN_PREFIX + "userSessionKey/one")
    @ApiOperation(value = "last userSessionKey", httpMethod = "POST")
    DataResult<String> selectLastUserSessionKey();

    @PostMapping(FeignConstants.FEIGN_PREFIX + "register")
    DataResult<TUserData> register(TUserData userData);
}